const webpack = require('webpack');

module.exports = {
	resolve: {
		fallback: {
			"buffer": require.resolve("buffer"),
			"crypto": require.resolve("crypto-browserify"),
			"stream": require.resolve("stream-browserify"),
		},
	},
	rules: [
		{
		    test: /.vue$/,
		    loader: 'vue-loader'
		},
		{
		test: /\.js$/,
		exclude: /node_modules/,
		use: {
			loader: 'babel-loader',
			options: {
				presets: [
					[
						'@babel/preset-env',
						{
							targets: 'defaults', // 也可以根据具体需求设置目标环境
							useBuiltIns: 'entry',
							corejs: 3,
						},
					],
				],
			},
		},
	}, ],
	plugins: [
		new webpack.ProvidePlugin({
			Buffer: ['buffer', 'Buffer'],
		}),
	],
};